<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>WYMeditor Unit Tests</title>
<script type="text/javascript" src="../../jquery/jquery.js"></script>
<script type="text/javascript" src="../../wymeditor/lang/en.js"></script>
<script type="text/javascript" src="../../wymeditor/jquery.wymeditor.js"></script>
<script type="text/javascript" src="../../wymeditor/jquery.wymeditor.explorer.js"></script>
<script type="text/javascript" src="../../wymeditor/jquery.wymeditor.mozilla.js"></script>
<script type="text/javascript" src="../../wymeditor/jquery.wymeditor.opera.js"></script>
<script type="text/javascript" src="../../wymeditor/xhtml_parser.js"></script>
<script type="text/javascript" src="../../wymeditor/wym_css_parser.js"></script>
<script type="text/javascript" src="testrunner.js"></script>
<link type="text/css" rel="stylesheet" media="screen" href="testsuite.css" />
<script type="text/javascript">
var WymInstance = null;
jQuery(function() {jQuery('.wymeditor').wymeditor({
    postInit: function(wym){  
        WymInstance = wym;
        jQuery('#userAgent').html(navigator.userAgent);
        runTest();
    }
});});

</script>
</head>
<body id="body">
    <h1 id="banner">WYMeditor - Test Suite</h1>
    <h2 id="userAgent"></h2>

    <!-- Test HTML -->
    <div id="main" style="display: none;">
        <form method="post" action="">
            <textarea class="wymeditor"></textarea>
            <input type="submit" class="wymsubmit" />
        </form>
   </div>
   
   <script type="text/javascript">
   
   test("Should escape URL's only once #69.1", function() {
       var original = "index.php?module=x&func=view&id=1";
       var expected = "index.php?module=x&amp;func=view&amp;id=1";
       equals( WymInstance.helper.escapeOnce( original ), expected, "Escape entities");
       equals( WymInstance.helper.escapeOnce( expected ), expected, "Avoids double entity escaping");
   });

   test("Should correct bad formated lists", function() {
       var expected = "<ul><li>a<ul><li>a.1</li></ul></li><li>b</li></ul>";
       
       // FF
       var design_mode_pseudo_html = "<ul><li>a</li><ul><li>a.1</li></ul><li>b<br></li></ul>";
       equals( WymInstance.parser.parse(design_mode_pseudo_html), expected, "on Firefox");
       
       // IE
       var design_mode_pseudo_html = "<UL>\r\n<LI>a</LI>\r\n<UL>\r\n<LI>a.1</LI></UL>\r\n<LI>b</LI></UL>";
       equals( WymInstance.parser.parse(design_mode_pseudo_html), expected, "on IE");
   });

   </script>
    <ol id="tests"></ol>
</body>
</html>
